# eric7.Debugger.DebuggerInterfacePython

Module implementing the Python3 debugger interface for the debug server.

### Global Attributes

ClientDefaultCapabilities

### Classes

DebuggerInterfacePython | Class implementing the debugger interface for the debug server for Python 3.

### Functions

createDebuggerInterfacePython3 | Module function to create a debugger interface instance.
getRegistryData | Module function to get characterizing data for the supported debugger interfaces.

## DebuggerInterfacePython

Class implementing the debugger interface for the debug server for Python 3.

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

DebuggerInterfacePython | Constructor
__assignDebuggerId | Private method to set the debugger id for a recent debugger connection attempt.
__determineDebugClient | Private method to determine the debug client to be started.
__ericServerTranslation | Private method to perform the eric-ide server path translation.
__flush | Private slot to flush the queue.
__handleServerDebugClientDisconnected | Private slot handling the disconnect of a debug client.
__handleServerLastClientExited | Private slot to handle the exit of the last debug client connected.
__identityTranslation | Private method to perform the identity path translation.
__receiveJson | Private method to handle data from the client.
__remoteTranslation | Private method to perform the path translation.
__sendJsonCommand | Private method to send a single command to the client.
__shutdownSocket | Private slot to shut down a socket.
__socketDisconnected | Private slot handling a socket disconnecting.
__startProcess | Private method to start the debugger client process.
__writeJsonCommandToSocket | Private method to write a JSON command to the socket.
getClientCapabilities | Public method to retrieve the debug clients capabilities.
getDebuggerIds | Public method to return the IDs of the connected debugger backends.
handleJsonCommand | Public method to handle a command or response serialized as a JSON string.
isConnected | Public method to test, if a debug client has connected.
newConnection | Public slot to handle a new connection.
remoteBanner | Public slot to get the banner info of the remote client.
remoteBreakpoint | Public method to set or clear a breakpoint.
remoteBreakpointEnable | Public method to enable or disable a breakpoint.
remoteBreakpointIgnore | Public method to ignore a breakpoint the next couple of occurrences.
remoteCapabilities | Public slot to get the debug clients capabilities.
remoteClientDisassembly | Public method to ask the client for the latest traceback disassembly.
remoteClientSetFilter | Public method to set a variables filter list.
remoteClientStack | Public method to request the stack of the main thread.
remoteClientVariable | Public method to request the variables of the debugged program.
remoteClientVariables | Public method to request the variables of the debugged program.
remoteCompletion | Public slot to get the a list of possible commandline completions from the remote client.
remoteContinue | Public method to continue the debugged program.
remoteContinueUntil | Public method to continue the debugged program to the given line or until returning from the current frame.
remoteCoverage | Public method to load a new program to collect coverage data.
remoteEnvironment | Public method to set the environment for a program to debug, run, ...
remoteLoad | Public method to load a new program to debug.
remoteMoveIP | Public method to move the instruction pointer to a different line.
remoteNoDebugList | Public method to set a list of programs not to be debugged.
remoteProfile | Public method to load a new program to collect profiling data.
remoteRawInput | Public method to send the raw input to the debugged program.
remoteRun | Public method to load a new program to run.
remoteSetThread | Public method to request to set the given thread as current thread.
remoteStatement | Public method to execute a Python statement.
remoteStep | Public method to single step the debugged program.
remoteStepOut | Public method to step out the debugged program.
remoteStepOver | Public method to step over the debugged program.
remoteStepQuit | Public method to stop the debugged program.
remoteThreadList | Public method to request the list of threads from the client.
remoteWatchpoint | Public method to set or clear a watch expression.
remoteWatchpointEnable | Public method to enable or disable a watch expression.
remoteWatchpointIgnore | Public method to ignore a watch expression the next couple of occurrences.
setAutoContinue | Public method to set the automatic continue flag of the interface.
setCallTraceEnabled | Public method to set the call trace state.
shutdown | Public method to cleanly shut down.
startRemote | Public method to start a remote Python interpreter.
startRemoteForProject | Public method to start a remote Python interpreter for a project.

### Static Methods

None

#### DebuggerInterfacePython (Constructor)

DebuggerInterfacePython(debugServer, passive)

Constructor

debugServer (DebugServer)
  reference to the debug server
passive (bool)
  flag indicating passive connection mode

#### DebuggerInterfacePython.__assignDebuggerId

__assignDebuggerId(sock, debuggerId)

Private method to set the debugger id for a recent debugger connection attempt.

sock (QTcpSocket)
  reference to the socket object
debuggerId (str)
  id of the connected debug client

#### DebuggerInterfacePython.__determineDebugClient

__determineDebugClient()

Private method to determine the debug client to be started.

Return:
  path of the debug client

Return Type:
  str

#### DebuggerInterfacePython.__ericServerTranslation

__ericServerTranslation(fn, remote2local=True)

Private method to perform the eric-ide server path translation.

fn (str)
  filename to be translated
remote2local (bool (optional))
  flag indicating the direction of translation (False = local to remote, True = remote to local) (defaults to True)

Return:
  translated filename

Return Type:
  str

#### DebuggerInterfacePython.__flush

__flush()

Private slot to flush the queue.

#### DebuggerInterfacePython.__handleServerDebugClientDisconnected

__handleServerDebugClientDisconnected(debuggerId)

Private slot handling the disconnect of a debug client.

debuggerId (str)
  ID of the disconnected debugger

#### DebuggerInterfacePython.__handleServerLastClientExited

__handleServerLastClientExited()

Private slot to handle the exit of the last debug client connected.

#### DebuggerInterfacePython.__identityTranslation

__identityTranslation(fn, remote2local=True)

Private method to perform the identity path translation.

fn (str)
  filename to be translated
remote2local (bool (optional))
  flag indicating the direction of translation (False = local to remote, True = remote to local) (defaults to True) (unused)

Return:
  translated filename

Return Type:
  str

#### DebuggerInterfacePython.__receiveJson

__receiveJson(sock)

Private method to handle data from the client.

sock (QTcpSocket)
  reference to the socket to read data from

#### DebuggerInterfacePython.__remoteTranslation

__remoteTranslation(fn, remote2local=True)

Private method to perform the path translation.

fn (str)
  filename to be translated
remote2local (bool (optional))
  flag indicating the direction of translation (False = local to remote, True = remote to local) (defaults to True)

Return:
  translated filename

Return Type:
  str

#### DebuggerInterfacePython.__sendJsonCommand

__sendJsonCommand(command, params, debuggerId="", sock=None)

Private method to send a single command to the client.

command (str)
  command name to be sent
params (dict)
  dictionary of named parameters for the command
debuggerId (str)
  id of the debug client to send the command to
sock (QTcpSocket)
  reference to the socket object to be used (only used if debuggerId is not given)

#### DebuggerInterfacePython.__shutdownSocket

__shutdownSocket(sock)

Private slot to shut down a socket.

sock (QTcpSocket)
  reference to the socket

#### DebuggerInterfacePython.__socketDisconnected

__socketDisconnected(sock)

Private slot handling a socket disconnecting.

sock (QTcpSocket)
  reference to the disconnected socket

#### DebuggerInterfacePython.__startProcess

__startProcess(program, arguments, environment=None, workingDir="")

Private method to start the debugger client process.

program (str)
  name of the executable to start
arguments (list of str)
  arguments to be passed to the program
environment (dict of str)
  dictionary of environment settings to pass
workingDir (str)
  directory to start the debugger client in

Return:
  the process object

Return Type:
  QProcess or None

#### DebuggerInterfacePython.__writeJsonCommandToSocket

__writeJsonCommandToSocket(jsonCommand, sock)

Private method to write a JSON command to the socket.

jsonCommand (str)
  JSON encoded command to be sent
sock (QTcpSocket)
  reference to the socket to write to

#### DebuggerInterfacePython.getClientCapabilities

getClientCapabilities()

Public method to retrieve the debug clients capabilities.

Return:
  debug client capabilities

Return Type:
  int

#### DebuggerInterfacePython.getDebuggerIds

getDebuggerIds()

Public method to return the IDs of the connected debugger backends.

Return:
  list of connected debugger backend IDs

Return Type:
  list of str

#### DebuggerInterfacePython.handleJsonCommand

handleJsonCommand(jsonStr, sock)

Public method to handle a command or response serialized as a JSON string.

jsonStr (str)
  string containing the command or response received from the debug backend
sock (QTcpSocket)
  reference to the socket the data was received from

#### DebuggerInterfacePython.isConnected

isConnected()

Public method to test, if a debug client has connected.

Return:
  flag indicating the connection status

Return Type:
  bool

#### DebuggerInterfacePython.newConnection

newConnection(sock)

Public slot to handle a new connection.

sock (QTcpSocket)
  reference to the socket object

Return:
  flag indicating success

Return Type:
  bool

#### DebuggerInterfacePython.remoteBanner

remoteBanner()

Public slot to get the banner info of the remote client.

#### DebuggerInterfacePython.remoteBreakpoint

remoteBreakpoint(debuggerId, fn, line, setBreakpoint, cond=None, temp=False)

Public method to set or clear a breakpoint.

debuggerId (str)
  ID of the debugger backend
fn (str)
  filename the breakpoint belongs to
line (int)
  line number of the breakpoint
setBreakpoint (bool)
  flag indicating setting or resetting a breakpoint
cond (str)
  condition of the breakpoint
temp (bool)
  flag indicating a temporary breakpoint

#### DebuggerInterfacePython.remoteBreakpointEnable

remoteBreakpointEnable(debuggerId, fn, line, enable)

Public method to enable or disable a breakpoint.

debuggerId (str)
  ID of the debugger backend
fn (str)
  filename the breakpoint belongs to
line (int)
  line number of the breakpoint
enable (bool)
  flag indicating enabling or disabling a breakpoint

#### DebuggerInterfacePython.remoteBreakpointIgnore

remoteBreakpointIgnore(debuggerId, fn, line, count)

Public method to ignore a breakpoint the next couple of occurrences.

debuggerId (str)
  ID of the debugger backend
fn (str)
  filename the breakpoint belongs to
line (int)
  line number of the breakpoint
count (int)
  number of occurrences to ignore

#### DebuggerInterfacePython.remoteCapabilities

remoteCapabilities(debuggerId)

Public slot to get the debug clients capabilities.

debuggerId (str)
  ID of the debugger backend

#### DebuggerInterfacePython.remoteClientDisassembly

remoteClientDisassembly(debuggerId)

Public method to ask the client for the latest traceback disassembly.

debuggerId (str)
  ID of the debugger backend

#### DebuggerInterfacePython.remoteClientSetFilter

remoteClientSetFilter(debuggerId, scope, filterStr)

Public method to set a variables filter list.

debuggerId (str)
  ID of the debugger backend
scope (int)
  scope of the variables (0 = local, 1 = global)
filterStr (str)
  regexp string for variable names to filter out

#### DebuggerInterfacePython.remoteClientStack

remoteClientStack(debuggerId)

Public method to request the stack of the main thread.

debuggerId (str)
  ID of the debugger backend

#### DebuggerInterfacePython.remoteClientVariable

remoteClientVariable(debuggerId, scope, filterList, var, framenr=0, maxSize=0)

Public method to request the variables of the debugged program.

debuggerId (str)
  ID of the debugger backend
scope (int)
  scope of the variables (0 = local, 1 = global)
filterList (list of str)
  list of variable types to filter out
var (list of str)
  list encoded name of variable to retrieve
framenr (int)
  framenumber of the variables to retrieve
maxSize (int)
  maximum size the formatted value of a variable will be shown. If it is bigger than that, a 'too big' indication will be given (@@TOO_BIG_TO_SHOW@@).

#### DebuggerInterfacePython.remoteClientVariables

remoteClientVariables(debuggerId, scope, filterList, framenr=0, maxSize=0)

Public method to request the variables of the debugged program.

debuggerId (str)
  ID of the debugger backend
scope (int)
  scope of the variables (0 = local, 1 = global)
filterList (list of str)
  list of variable types to filter out
framenr (int)
  framenumber of the variables to retrieve
maxSize (int)
  maximum size the formatted value of a variable will be shown. If it is bigger than that, a 'too big' indication will be given (@@TOO_BIG_TO_SHOW@@).

#### DebuggerInterfacePython.remoteCompletion

remoteCompletion(debuggerId, text)

Public slot to get the a list of possible commandline completions from the remote client.

debuggerId (str)
  ID of the debugger backend
text (str)
  text to be completed

#### DebuggerInterfacePython.remoteContinue

remoteContinue(debuggerId, special=False)

Public method to continue the debugged program.

debuggerId (str)
  ID of the debugger backend
special (bool)
  flag indicating a special continue operation

#### DebuggerInterfacePython.remoteContinueUntil

remoteContinueUntil(debuggerId, line)

Public method to continue the debugged program to the given line or until returning from the current frame.

debuggerId (str)
  ID of the debugger backend
line (int)
  new line, where execution should be continued to

#### DebuggerInterfacePython.remoteCoverage

remoteCoverage(fn, argv, wd, erase=False)

Public method to load a new program to collect coverage data.

fn (str)
  filename to run
argv (list of str)
  list of command line arguments to pass to the program
wd (str)
  working directory for the program
erase (bool)
  flag indicating that coverage info should be cleared first

#### DebuggerInterfacePython.remoteEnvironment

remoteEnvironment(env)

Public method to set the environment for a program to debug, run, ...

env (dict)
  environment settings

#### DebuggerInterfacePython.remoteLoad

remoteLoad(fn, argv, wd, traceInterpreter=False, autoContinue=True, enableMultiprocess=False, reportAllExceptions=False, )

Public method to load a new program to debug.

fn (str)
  filename to debug
argv (list of str)
  list of command line arguments to pass to the program
wd (str)
  working directory for the program
traceInterpreter (bool)
  flag indicating if the interpreter library should be traced as well
autoContinue (bool)
  flag indicating, that the debugger should not stop at the first executable line
enableMultiprocess (bool)
  flag indicating to perform multiprocess debugging
reportAllExceptions (bool)
  flag indicating to report all exceptions instead of unhandled exceptions only

#### DebuggerInterfacePython.remoteMoveIP

remoteMoveIP(debuggerId, line)

Public method to move the instruction pointer to a different line.

debuggerId (str)
  ID of the debugger backend
line (int)
  new line, where execution should be continued

#### DebuggerInterfacePython.remoteNoDebugList

remoteNoDebugList(debuggerId, noDebugList)

Public method to set a list of programs not to be debugged.

The programs given in the list will not be run under the control of the multi process debugger.

debuggerId (str)
  ID of the debugger backend
noDebugList (list of str)
  list of Python programs not to be debugged

#### DebuggerInterfacePython.remoteProfile

remoteProfile(fn, argv, wd, erase=False)

Public method to load a new program to collect profiling data.

fn (str)
  filename to run
argv (list of str)
  list of command line arguments to pass to the program
wd (str)
  working directory for the program
erase (bool)
  flag indicating that timing info should be cleared first

#### DebuggerInterfacePython.remoteRawInput

remoteRawInput(debuggerId, inputString)

Public method to send the raw input to the debugged program.

debuggerId (str)
  ID of the debugger backend
inputString (str)
  raw input

#### DebuggerInterfacePython.remoteRun

remoteRun(fn, argv, wd)

Public method to load a new program to run.

fn (str)
  filename to run
argv (list of str)
  list of command line arguments to pass to the program
wd (str)
  working directory for the program

#### DebuggerInterfacePython.remoteSetThread

remoteSetThread(debuggerId, tid)

Public method to request to set the given thread as current thread.

debuggerId (str)
  ID of the debugger backend
tid (int)
  id of the thread

#### DebuggerInterfacePython.remoteStatement

remoteStatement(debuggerId, stmt)

Public method to execute a Python statement.

debuggerId (str)
  ID of the debugger backend
stmt (str)
  Python statement to execute.

#### DebuggerInterfacePython.remoteStep

remoteStep(debuggerId)

Public method to single step the debugged program.

debuggerId (str)
  ID of the debugger backend

#### DebuggerInterfacePython.remoteStepOut

remoteStepOut(debuggerId)

Public method to step out the debugged program.

debuggerId (str)
  ID of the debugger backend

#### DebuggerInterfacePython.remoteStepOver

remoteStepOver(debuggerId)

Public method to step over the debugged program.

debuggerId (str)
  ID of the debugger backend

#### DebuggerInterfacePython.remoteStepQuit

remoteStepQuit(debuggerId)

Public method to stop the debugged program.

debuggerId (str)
  ID of the debugger backend

#### DebuggerInterfacePython.remoteThreadList

remoteThreadList(debuggerId)

Public method to request the list of threads from the client.

debuggerId (str)
  ID of the debugger backend

#### DebuggerInterfacePython.remoteWatchpoint

remoteWatchpoint(debuggerId, cond, setWatch, temp=False)

Public method to set or clear a watch expression.

debuggerId (str)
  ID of the debugger backend
cond (str)
  expression of the watch expression
setWatch (bool)
  flag indicating setting or resetting a watch expression
temp (bool)
  flag indicating a temporary watch expression

#### DebuggerInterfacePython.remoteWatchpointEnable

remoteWatchpointEnable(debuggerId, cond, enable)

Public method to enable or disable a watch expression.

debuggerId (str)
  ID of the debugger backend
cond (str)
  expression of the watch expression
enable (bool)
  flag indicating enabling or disabling a watch expression

#### DebuggerInterfacePython.remoteWatchpointIgnore

remoteWatchpointIgnore(debuggerId, cond, count)

Public method to ignore a watch expression the next couple of occurrences.

debuggerId (str)
  ID of the debugger backend
cond (str)
  expression of the watch expression
count (int)
  number of occurrences to ignore

#### DebuggerInterfacePython.setAutoContinue

setAutoContinue(autoContinue)

Public method to set the automatic continue flag of the interface.

If this is set to True, the debugger will tell the debug client to continue when it stops at the first line of the script to be debugged.

autoContinue (bool)
  flag indicating the auto continue state

#### DebuggerInterfacePython.setCallTraceEnabled

setCallTraceEnabled(debuggerId, on)

Public method to set the call trace state.

debuggerId (str)
  ID of the debugger backend
on (bool)
  flag indicating to enable the call trace function

#### DebuggerInterfacePython.shutdown

shutdown()

Public method to cleanly shut down.

It closes our sockets and shuts down the debug clients. (Needed on Win OS)

#### DebuggerInterfacePython.startRemote

startRemote(port, runInConsole, venvName, originalPathString, workingDir="", configOverride=None, startViaServer=None, )

Public method to start a remote Python interpreter.

port (int)
  port number the debug server is listening on
runInConsole (bool)
  flag indicating to start the debugger in a console window
venvName (str)
  name of the virtual environment to be used
originalPathString (str)
  original PATH environment variable
workingDir (str (optional))
  directory to start the debugger client in (defaults to "")
configOverride (dict (optional))
  dictionary containing the global config override data (defaults to None)
startViaServer (bool (optional))
  flag indicating to start the client via an eric-ide server (defaults to None)

Return:
  client process object, a flag to indicate a network connection and the name of the interpreter in case of a local execution

Return Type:
  tuple of (QProcess, bool, str)

#### DebuggerInterfacePython.startRemoteForProject

startRemoteForProject(port, runInConsole, venvName, originalPathString, workingDir=None, configOverride=None, startViaServer=None, )

Public method to start a remote Python interpreter for a project.

port (int)
  port number the debug server is listening on
runInConsole (bool)
  flag indicating to start the debugger in a console window
venvName (str)
  name of the virtual environment to be used
originalPathString (str)
  original PATH environment variable
workingDir (str)
  directory to start the debugger client in
configOverride (dict)
  dictionary containing the global config override data
startViaServer (bool (optional))
  flag indicating to start the client via an eric-ide server (defaults to None)

Return:
  client process object, a flag to indicate a network connection and the name of the interpreter in case of a local execution

Return Type:
  tuple of (QProcess, bool, str)

Up

## createDebuggerInterfacePython3

createDebuggerInterfacePython3(debugServer, passive)

Module function to create a debugger interface instance.

debugServer (DebugServer)
  reference to the debug server
passive (bool)
  flag indicating passive connection mode

Return:
  instantiated debugger interface

Return Type:
  DebuggerInterfacePython

Up

## getRegistryData

getRegistryData()

Module function to get characterizing data for the supported debugger interfaces.

Return:
  list of tuples containing the client type, the client capabilities, the client file type associations and a reference to the creation function

Return Type:
  list of tuple of (str, int, list of str, function)

Up